﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace TestSamples
{
    public partial class App : Application
    {
        // Constructor
        public App()
        {
            // Standard Silverlight initialization
            InitializeComponent();

            this.Startup += App_Startup;
        }

        void App_Startup(object sender, StartupEventArgs e)
        {
            // We will notify the runner about the assemblies that contain the NUnit Test Classes.
            // Two possible ways, just one assembly (The calling assembly will be identified in the called method) or a list of assemblies.
            //NUnitTestRunnerWP7.NUnitTestRunner.Setup();
            // Adding a list of assemblies
            // The external assemblies should be referenced in this project so they will be deployed in the XAP file
            var assembliesList = new List<Assembly>();
            Assembly assembly = Assembly.Load("SampleTestsAssembly"); // Adding the assembly by name

            //Assembly assembly = typeof(SampleTestsAssembly.ExternalSampleTests).Assembly; // Adding by using a type declared inside it
            assembliesList.Add(assembly); // No need to add the calling assembly, it will be added automatically in the called method.
            NUnitTestRunnerWP7.NUnitTestRunner.Setup(assembliesList);
        }
    }
}